<template>
	<div>
		<button @click="a = !a">显示/隐藏</button>
		<transition name="hello1">
			<h1 v-if="a">你好1</h1>
		</transition>
		<transition name="hello2">
			<h1 v-if="a">你好2</h1>
		</transition>
	</div>
</template>

<script>
	export default {
		name:'App',
		data() {
			return {
				a:true
			}
		},
	}
</script>

<style>
	h1{
		background-color: orange;
	}
	.hello1-enter-active {
		animation: atguigu 1s linear reverse;
	}
	.hello1-leave-active {
		animation: atguigu 1s linear;
	}
	.hello2-enter-active {
		animation: atguigu 2s linear reverse;
	}
	.hello2-leave-active {
		animation: atguigu 2s linear;
	}
	@keyframes atguigu {
		0%{
			transform: translateX(0px);
		}
		100%{
			transform: translateX(-100%);
		}
	}
</style>